package student.action;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import com.util.MyLog;
import com.dao.*;
import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import com.util.DB;

//import edu.wfmanage.models.Lookup;
import edu.student.models.*;

/**
 * 
 * @author Ruchika Sharma
 */

public class ShowSearch extends ActionSupport {
	private String rollNo;
	private String username="";
	private List<News> news;
	private List<Announcements> announcements;
	private String image="";
	private Timestamp lastLogin;

	public String execute() {
		MyLog.log("in ShowSearch.execute()" ); 
		User user=new User();
		Map<String, Object> session = ActionContext.getContext().getSession();
		
		if(session.get("user") != null && session.get("user") != "")
			user = (User) session.get("user");
		session.put("user", user);
			rollNo = user.getRollNor();
			username=user.getUsername();
			image=user.getImage();
			lastLogin=user.getLastLogin();
			news = News.getNews(" where ui.roll_No='"+user.getRollNor()+"' ");
			announcements=Announcements.getAnnouncements(" where ui.roll_No='"+user.getRollNor()+"' ");
			return "success";
   
	   }

	public String getRollNo() {
		return rollNo;
	}

	public void setRollNo(String rollNo) {
		this.rollNo = rollNo;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public List<News> getNews() {
		return news;
	}

	public void setNews(List<News> news) {
		this.news = news;
	}

	public List<Announcements> getAnnouncements() {
		return announcements;
	}

	public void setAnnouncements(List<Announcements> announcements) {
		this.announcements = announcements;
	}

	public String getImage() {
		return image;
	}

	public void setImage(String image) {
		this.image = image;
	}

	public Timestamp getLastLogin() {
		return lastLogin;
	}

	public void setLastLogin(Timestamp lastLogin) {
		this.lastLogin = lastLogin;
	}
	 
    
        
   
}
